package com.ruoyi.rsikManage.controller;

import java.util.List;


import com.ruoyi.rsikManage.domain.TVideoQualityDictionary;
import com.ruoyi.rsikManage.service.ITVideoQualityDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.servlet.http.HttpServletResponse;

/**
 * 视频质量字典Controller
 * 
 * @author ruoyi
 * @date 2023-08-08
 */
@RestController
@RequestMapping("/zdzh/videoQuality")
public class TVideoQualityDictionaryController extends BaseController
{
    @Autowired
    private ITVideoQualityDictionaryService tVideoQualityDictionaryService;

    /**
     * 查询视频质量字典列表
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:videoQuality:list')")
    @GetMapping("/list")
    public TableDataInfo list(TVideoQualityDictionary tVideoQualityDictionary)
    {
        startPage();
        List<TVideoQualityDictionary> list = tVideoQualityDictionaryService.selectTVideoQualityDictionaryList(tVideoQualityDictionary);
        return getDataTable(list);
    }

    /**
     * 导出视频质量字典列表
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:videoQuality:export')")
    @Log(title = "视频质量字典", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public void export(HttpServletResponse response,TVideoQualityDictionary tVideoQualityDictionary)
    {
        List<TVideoQualityDictionary> list = tVideoQualityDictionaryService.selectTVideoQualityDictionaryList(tVideoQualityDictionary);
        ExcelUtil<TVideoQualityDictionary> util = new ExcelUtil<TVideoQualityDictionary>(TVideoQualityDictionary.class);
         util.exportExcel(response,list, "videoQuality");
    }

    /**
     * 获取视频质量字典详细信息
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:videoQuality:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tVideoQualityDictionaryService.selectTVideoQualityDictionaryById(id));
    }

    /**
     * 新增视频质量字典
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:videoQuality:add')")
    @Log(title = "视频质量字典", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TVideoQualityDictionary tVideoQualityDictionary)
    {
        return toAjax(tVideoQualityDictionaryService.insertTVideoQualityDictionary(tVideoQualityDictionary));
    }

    /**
     * 修改视频质量字典
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:videoQuality:edit')")
    @Log(title = "视频质量字典", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TVideoQualityDictionary tVideoQualityDictionary)
    {
        return toAjax(tVideoQualityDictionaryService.updateTVideoQualityDictionary(tVideoQualityDictionary));
    }

    /**
     * 删除视频质量字典
     */
   // @PreAuthorize("@ss.hasPermi('zdzh:videoQuality:remove')")
    @Log(title = "视频质量字典", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tVideoQualityDictionaryService.deleteTVideoQualityDictionaryByIds(ids));
    }
}
